package com.group3.fallback.order;

import com.group3.Feign.OrderServiceFeign;
import com.group3.common.result.ApiResponse;
import com.group3.model.Order;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
@Component
public class OrderServiceFallback implements OrderServiceFeign {
    @Override
    public ApiResponse addOrder(Integer uid, Integer pid) {

        return ApiResponse.error("下单失败,订单服务不可用");
    }

    @Override
    public List<Order> getOrderListbyUid(Integer uid) {
        Order order = new Order();
        order.setStatus(0);
        order.setPname("订单服务不可用");
        List<Order> orderList = new ArrayList<>();
        orderList.add(order);
        return orderList;
    }

    @Override
    public Order getOrderByOid(Integer id) {
        Order order = new Order();
        order.setStatus(0);
        order.setPname("订单服务不可用");
        return order;
    }

    @Override
    public boolean updateOrder(Order order) {

        return false;
    }

    @Override
    public ApiResponse payOrder(Integer oid) {
        ApiResponse apiResponse = ApiResponse.error("支付失败,订单服务不可用");
        return apiResponse;
    }
}
